public class Test {
    public static void main(String[] args) {
        int[] nums = {1,3,3,3,5,6};
        remove(nums);
    }
    public static void remove(int[] nums) {
        int count = 1;
        int end = nums.length-1;
        for (int i = 0; i < nums.length;) {
            if(i == end) {
                break;
            }
            if (nums[i] == nums[i+1]) {
                for (int j = i; j < nums.length; j++) {
                    if(j == nums.length-1) {
                        break;
                    }
                    nums[j] = nums[j+1];
                }
                end--;
            }else {
                i++;
                count++;
            }
        }
        for (int i = 0; i < count; i++) {
            System.out.println(nums[i]);
        }
    }
}
